package coop.bancocredicoop.proyectos.gd.alfresco;

import java.io.IOException;

import coop.bancocredicoop.proyectos.gd.GDConfig;

public class Utils {
	
	static private AlfrescoHttpClient getAlfrescoClientFromConfig(AlfrescoConfig alfrescoConfig, String actingAsUser) throws IOException {
        AlfrescoServiceConnection alfConnection = new AlfrescoServiceConnection(alfrescoConfig);
        return alfConnection.getClient(actingAsUser);		
	}
	
	static public AlfrescoHttpClient getAlfrescoClientFromConfigAsSystemUser() throws IOException {
		AlfrescoConfig alfConfig = new GDConfig().getAlfrescoConfig();
		return getAlfrescoClientFromConfig(alfConfig, alfConfig.getUserName());
	}
	
	static public AlfrescoHttpClient getAlfrescoClientFromConfigAsUser(String actingAsUser) throws IOException {
		AlfrescoConfig alfConfig = new GDConfig().getAlfrescoConfig();
		return getAlfrescoClientFromConfig(alfConfig, actingAsUser);
	}

}
